class_name HitBox
extends Area2D

# 攻击信号
signal hit(hurtbox: HurtBox)

# 绑定信号回调
func _init() -> void:
	area_entered.connect(_on_area_entered)

func _on_area_entered(hurtBox: HurtBox) -> void:
	print("[Hit] %s=>%s" % [owner.name, hurtBox.owner.name])
	# 发出信号(谁攻击，谁受击)
	hit.emit(hurtBox)
	hurtBox.hurt.emit(self)
